import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface DeleteDelModelRelationById_ {
  /**
   * @description id
   */
  id: number;
}
export interface DeleteDeleteById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetDeriveModelListById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetDetailById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetDevelopMetricsModelListById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetModelDimListById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetModelRelationByModelIdById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetModelTableRelColumnById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetModelTreeById_ {
  /**
   * @description id
   */
  id: number;
}

export class DataModel {
  /**
   * 删除模型关联(包含子节点)
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/batchDelModelRelation
   * @secure
   */
  postBatchDelModelRelation = (dto: defs.DelModelRelationDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataModel/batchDelModelRelation`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 删除模型关联
   *
   * @tags 数据模型-管理
   * @request DELETE: /dataModel/delModelRelation/{id}
   * @secure
   */
  deleteDelModelRelationById = (
    { id }: { id: number } | DeleteDelModelRelationById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataModel/delModelRelation/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 删除模型
   *
   * @tags 数据模型-管理
   * @request DELETE: /dataModel/delete/{id}
   * @secure
   */
  deleteDeleteById = ({ id }: { id: number } | DeleteDeleteById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataModel/delete/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 模型操作日志记录-分页
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/getDataModelLog
   * @secure
   */
  postGetDataModelLog = (dto: defs.ModelDetailQueryParam, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoDataModelLogVo>({
      url: `/dataModel/getDataModelLog`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 派生指标开发模型列表查询-非分页
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getDeriveModelList/{id}
   * @secure
   */
  getGetDeriveModelListById = ({ id }: { id: number } | GetGetDeriveModelListById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListDataModelVo>({
      url: `/dataModel/getDeriveModelList/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 获取模型详情
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getDetail/{id}
   * @secure
   */
  getGetDetailById = ({ id }: { id: number } | GetGetDetailById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataModelVo>({
      url: `/dataModel/getDetail/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 获取已开发指标下的模型列表
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getDevelopMetricsModelList/{id}
   * @secure
   */
  getGetDevelopMetricsModelListById = (
    { id }: { id: number } | GetGetDevelopMetricsModelListById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListDataModelVo>({
      url: `/dataModel/getDevelopMetricsModelList/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 模型下维度列表查询-非分页
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getModelDimList/{id}
   * @secure
   */
  getGetModelDimListById = ({ id }: { id: number } | GetGetModelDimListById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListTableFieldRelationVo>({
      url: `/dataModel/getModelDimList/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 模型下维度列表查询-分页
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/getModelDimPage
   * @secure
   */
  postGetModelDimPage = (dto: defs.ModelDetailQueryParam, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoTableFieldRelationVo>({
      url: `/dataModel/getModelDimPage`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 模型列表查询-非分页
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getModelList
   * @secure
   */
  getGetModelList = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListDataModelVo>({
      url: `/dataModel/getModelList`,
      method: "GET",
      ...params,
    });

  /**
   * 模型下已开发指标列表查询-分页
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/getModelMetricsPage
   * @secure
   */
  postGetModelMetricsPage = (dto: defs.ModelDetailQueryParam, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoModelMetricsVo>({
      url: `/dataModel/getModelMetricsPage`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 获取模型下表关联关系列表
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getModelRelationByModelId/{id}
   * @secure
   */
  getGetModelRelationByModelIdById = (
    { id }: { id: number } | GetGetModelRelationByModelIdById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListDataModelRelationVo>({
      url: `/dataModel/getModelRelationByModelId/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 指标开发获取模型下字段列表查询
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/getModelTableColumn
   * @secure
   */
  postGetModelTableColumn = (dto: defs.ModelTableCloumnQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListModelTableCloumnVo>({
      url: `/dataModel/getModelTableColumn`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 获取模型事实表字段关联列表
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getModelTableRelColumn/{id}
   * @secure
   */
  getGetModelTableRelColumnById = (
    { id }: { id: number } | GetGetModelTableRelColumnById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityMapStringListMapStringString>({
      url: `/dataModel/getModelTableRelColumn/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 获取模型详情树形结构
   *
   * @tags 数据模型-管理
   * @request GET: /dataModel/getModelTree/{id}
   * @secure
   */
  getGetModelTreeById = ({ id }: { id: number } | GetGetModelTreeById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataModelRelationVo>({
      url: `/dataModel/getModelTree/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 模型列表查询-分页
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/pageQuery
   * @secure
   */
  postPageQuery = (dto: defs.DataModelPageQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoDataModePagelVo>({
      url: `/dataModel/pageQuery`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 新增模型
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/saveModel
   * @secure
   */
  postSaveModel = (dto: defs.DataModelDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataModelDto>({
      url: `/dataModel/saveModel`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 修改模型(名称/描述)
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/updateModel
   * @secure
   */
  postUpdateModel = (dto: defs.DataModelDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataModelDto>({
      url: `/dataModel/updateModel`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 修改模型关联
   *
   * @tags 数据模型-管理
   * @request POST: /dataModel/updateModelRelation
   * @secure
   */
  postUpdateModelRelation = (dto: defs.DataModelDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataModelDto>({
      url: `/dataModel/updateModelRelation`,
      method: "POST",
      data: dto,
      ...params,
    });
}

export default new DataModel();
